package com.yang.config;


import org.springframework.beans.factory.annotation.Value;

import com.alibaba.druid.pool.DruidDataSource;
//注释掉之后则不生效
//@Configuration
//@PropertySource("classpath:jdbc.properties")
public class JdbcConfig {
	@Value("${jdbc.driver}")
	private String driverClassName;
	
	@Value("${jdbc.url}")
	private String url;
	
	@Value("${jdbc.username}")
	private String username;
	
	@Value("${jdbc.password}")
	private String password;
	
	//@Bean
	public DruidDataSource datasource(){
		DruidDataSource datasource = new DruidDataSource();
		datasource.setDriverClassName(driverClassName);
		datasource.setUrl(url);
		datasource.setUsername(username);
		datasource.setPassword(password);
		return  datasource;
	}
}











